package com.yboot.starter.holiday.core.impl;

import com.yboot.starter.api.core.cache.CacheService;
import com.yboot.starter.holiday.core.HolidayDataStorageService;
import com.yboot.starter.holiday.core.vo.HolidayResponseVo;

import java.util.List;

/**
 * 功能描述
 *
 * @author yangcs
 * @date 2025/8/22
 */
public class HolidayDataStorageServiceImpl implements HolidayDataStorageService {
    private final CacheService cacheService;

    public HolidayDataStorageServiceImpl(CacheService cacheService) {
        this.cacheService = cacheService;
    }

    @Override
    public boolean save(String year, List<HolidayResponseVo> list) {
        String key = "common:holiday:cache:" + year;
        cacheService.setCache(key, list);
        return true;
    }

    @Override
    public List<HolidayResponseVo> get(String year) {
        String key = "common:holiday:cache:" + year;
        return (List<HolidayResponseVo>) cacheService.getCache(key);
    }
}
